Port chainlist L2/testnet relations fix + CLAUDE.md + sources UI#43
Merged
Conversation
Rewrites the AI assistant context doc to match the post-PR-#39 architecture. Updates the source-layer diagram (transport → sources → store → domain → services → http), bumps the data-source count to 5 (adds L2BEAT), lists the new endpoints (/scaling, /metrics, /refresher, /clients, /relations/:id/graph, /keywords, /stats, /validate), notes pino logging, JSON Schema validation, and ESLint, and updates env vars + tests folder layout. The "Common tasks" section is rewritten to point at src/ paths instead of dataService.js / index.js.
Bug fix ------- Chainlist entries with parent.type === 'L2' or 'testnet' were not being processed for relations — only the bridge URLs were extracted, so a chain that appeared only in chainlist (with a parent declaration) never got its l2Of / testnetOf relation, the corresponding L2 tag, or the reverse parentOf / mainnetOf relation on the parent. In src/store/indexer.js, indexChainlistSource now calls processL2ParentRelation and processTestnetParentRelation in the chainlist second pass with source='chainlist'. Both helpers take an optional source parameter (default 'chains') so the same code path can attribute relations correctly. addReverseRelations already propagates the source to the reverse side, so chainlist-sourced relations also produce correctly-attributed reverse relations on the parent chain. Existing dedup logic (existingRelation check by kind + chainId) handles the case where both chains.json and chainlist declare the same parent. UI -- public/* adds a Sources toggle panel (bottom-right) that lets users enable/disable individual data sources (Chain ID Network, Chainlist, The Graph, SLIP-0044, L2BEAT). Toggling a source filters the 3D graph to show only chains whose sources array intersects the enabled set, and rebuilds the relations map accordingly. Tests ----- tests/unit/store/indexer-chainlist-relations.test.js (new file, 5 cases): - L2 relation extraction from chainlist parent - testnet relation extraction from chainlist parent - no duplicate relations when chains.json and chainlist agree - reverse parentOf created with source='chainlist' - reverse mainnetOf created with source='chainlist'
There was a problem hiding this comment.
Pull request overview
This PR forward-ports an abandoned branch onto the post-PR-#39 src/ architecture by fixing chainlist-derived L2/testnet parent relations in the indexer, adding a new CLAUDE.md architecture/developer guide, and introducing a UI panel to toggle which data sources are shown in the public 3D graph.
Changes:
- Fixes chainlist-only L2/testnet parent relations by attributing relations to
source='chainlist'during indexing. - Adds a “Sources” toggle panel in the static UI to filter the displayed graph by data source.
- Introduces
CLAUDE.mddocumenting architecture, workflows, endpoints, and conventions.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/store/indexer.js |
Attributes chainlist parent relations properly by invoking parent-relation processors during chainlist indexing. |
tests/unit/store/indexer-chainlist-relations.test.js |
Adds unit coverage for chainlist-derived parent relations and reverse relations attribution. |
public/index.html |
Adds the Sources toggle panel markup to the UI. |
public/app.js |
Implements source-based filtering and graph rebuild logic in the client UI. |
public/style.css |
Styles the Sources panel and custom checkbox toggles. |
CLAUDE.md |
Adds a repo-specific developer/architecture reference document aligned to the new src/ layout. |
| processL2ParentRelation(chainData, indexed, 'chainlist'); | ||
| processTestnetParentRelation(chainData, indexed, 'chainlist'); | ||
|
|
||
| if (chainData.parent?.bridges) { |
Comment on lines
+61
to
+70
| <div id="sourcesPanel" class="glass-panel sources-panel"> | ||
| <button id="sourcesToggle" class="sources-toggle" aria-label="Toggle data sources"> | ||
| <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" | ||
| stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | ||
| <circle cx="12" cy="12" r="3"></circle> | ||
| <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"></path> | ||
| </svg> | ||
| <span>Sources</span> | ||
| </button> | ||
| <div id="sourcesDropdown" class="sources-dropdown hidden"> |
| flex-shrink: 0; | ||
| transition: background 0.15s, border-color 0.15s; | ||
| } | ||
|
|
|
|
||
| ## Testing | ||
|
|
||
| **Framework:** Vitest with globals enabled (no explicit imports needed for `describe`, `it`, `expect`). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Forward-port of the abandoned
claude/add-claude-documentation-AiTVHbranch (2 commits, written against pre-refactormain) onto the post-PR-#39src/architecture.1. Bug fix — chainlist L2/testnet relations (
src/store/indexer.js)indexChainlistSourceonly ranmergeBridgesin its second pass, so a chain that appeared only in chainlist with aparent.typeofL2ortestnetnever got itsl2Of/testnetOfrelation, the correspondingL2tag, or a reverseparentOf/mainnetOfon the parent chain. Now callsprocessL2ParentRelationandprocessTestnetParentRelationwithsource='chainlist'.Both helpers gained an optional
sourceparameter (defaults to'chains') so attribution is correct.addReverseRelationsalready propagatesrelation.source, so reverse relations get the right attribution for free. Existing dedup logic handles the case where bothchains.jsonand chainlist declare the same parent.2. CLAUDE.md (new)
Rewritten from the original branch's text to match the current architecture: layered
src/diagram (transport → sources → store → domain → services → http), 5 data sources (adds L2BEAT), full endpoint list (/scaling,/metrics,/refresher,/clients,/validate,/relations/:id/graph, etc.), pino logging, JSON Schema validation, ESLint, refreshed env-var table.3. Sources toggle UI (
public/*)Bottom-right toggle panel — enable/disable individual data sources to filter the 3D graph. Originally 4 sources in the source branch; bumped to 5 here to include L2BEAT.
enabledSources.size === ALL_SOURCES.lengthshort-circuit is generalized so adding a 6th source later is one-line.Test plan
npm test→ 675 passed / 4 skipped / 0 failing (was 670 onmain; +5 new tests)npm run lint→ cleantests/unit/store/indexer-chainlist-relations.test.js:chains.jsonand chainlist agreeparentOfcreated withsource='chainlist'mainnetOfcreated withsource='chainlist'/ui/, toggle each source, confirm the 3D graph re-renders)Provenance
Replaces and supersedes the
claude/add-claude-documentation-AiTVHbranch (commitsfc95594,79102d2), which was written against the pre-refactordataService.jsmonolith and wouldn't apply cleanly to the newsrc/layout.Generated by Claude Code